{include file='common/_meta' /}
<body>
<div class="container">

    <form class="layui-form" action="" lay-filter="" id="form-article">
        <div class="layui-row">
            <div class="layui-form-item layui-col-sm6">
                <label class="layui-form-label">原单价：</label>
                <div class="layui-input-block">
                    <input type="text" placeholder="{$sms_price} 元/条"  class="layui-input" disabled>
                </div>
             </div>
        </div>

        <div class="layui-row">
            <div class="layui-form-item layui-col-sm6">
                <label class="layui-form-label"><span class="custom-color-red">*</span>新单价(元/条)：</label>
                <div class="layui-input-block">
                    <input type="text" id="newprice" name="newprice" value="" placeholder="请输入新单价" autocomplete="off" class="layui-input" onblur ="IWS_CheckDecimal(this)" onkeyup="IWS_CheckDecimal(this)">
                </div>
            </div>
        </div>

        <div class="layui-row">
            <div class="layui-form-item layui-form-text layui-col-sm6">
                <label class="layui-form-label">备注：</label>
                <div class="layui-input-block">
                    <textarea name="remarks" value="" placeholder="备注" class="layui-textarea" ></textarea>
                </div>
             </div>
        </div>

        <div class="layui-row">
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <input type="hidden" value="{$channel_id}" name="channel_id" >
                    <button class="layui-btn custom-sm-fluid" lay-submit lay-filter="formDemo">提交</button>
                </div>
            </div>
        </div>

    </form>

</div>
{include file="common/_footer"}

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript">
layui.use(['form', 'layer'], function() {

    var layer = layui.layer;
    var form  = layui.form;

    //监听提交
    form.on('submit(formDemo)', function(data) {

        layer.confirm('是否确认调价？', {
            btn: ['确认调价', '取消调价'] //可以无限个按钮
            ,yes: function(index, layero){

                var indexload = layer.load();

                $.ajax({
                    type : "POST",
                    url  : "{:url('BalanceShift/recharge_adjust')}",
                    data : $("#form-article").serialize(),
                    success : function(e){

                        layer.close(indexload);

                        if(e != 'success'){
                            layer.msg(e,{icon: 5,time:3000});
                            return false;
                        }
                        layer.msg('调价成功',{icon:1,time:1000},function(){
                            layer.open({type: 3});parent.location.reload();
                        });
                    },
                    error : function(e){

                        layer.close(indexload);

                        layer.msg('提交错误',{icon: 5,time:3000});
                    }
                });
            }
        });

        return false;
    });

});

/*验证金额*/
function IWS_CheckDecimal(obj) {
    var temp = /^\d+\.?\d{0,5}$/;
    if (temp.test(obj.value)) {
    } else {
        obj.value = obj.value.substr(0, obj.value.length - 1);
        IWS_CheckDecimal(obj);
    }
}

</script>
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>